<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>岗位管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/style.css" media="all">
    <script type="text/javascript" src="../../static/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../layui/layui.all.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../static/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../static/js/base.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../static/js/ax.js"></script>
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.js"></script>
    <script src="../../static/js/respond.js"></script>
    <![endif]-->
</head>
<body class="bg_w">

<div class="layui-fluid">
    <div class="content-wrap">
        <div class="layui-row layui-form-pane layui-col-space15">
            <div class="layui-col-sm4">
                <label class="layui-form-label">岗位代码</label>
                <div class="layui-input-block">
                    <input type="text" name="code" id="code" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-sm4">
                <label class="layui-form-label">岗位名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" id="name" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs4">
                <button class="layui-btn add_btn" data-type="reload" onclick="searchBtn()" ><i class="layui-icon layui-icon-search"></i>搜索</button>
                <button class="layui-btn newsAdd_btn add_btn" style="margin-left: 10px;">
                    <i  class="layui-icon layui-icon-add-1"></i>新增
                </button>
            </div>
        </div>
        <div class="layui-row">
            <table class="layui-hide" id="position" lay-filter="eventBtn"></table>
        </div>
    </div>
</div>

<script>


    var tableIns;
    var departmentCode;
    $(document).ready(function(){
        departmentCode= getQueryString('departmentCode');
        $("#positionId").val("");
        $("#positionName").val("");

        layui.use(['table', 'layer','element'], function(){
            var table = layui.table;
            tableIns =ax.VTable({
                elem: "#position",
                url:backendWebUrl+"/api/school/position/list",
                method: 'POST',
                cols: [[
                    {field:'序列号', width:80, title: '序列号', sort: true,type:'numbers'},
                    {field:'name', title: '岗位名称'},
                    {field:'code', title: '岗位代码'},
                    {field:'depName', title: '所属部门'},
                    {field:'operatorName', title: '创建人'},
                    {field:'created', title: '创建时间'}
                ]]
            });

            //监听行单击事件（单击事件为：rowDouble）
            table.on('row(eventBtn)', function(obj){
                var postionJson = obj.data;
                $("#positionId").val(postionJson.id);
                $("#positionName").val(postionJson.name);
                //标注选中样式
                obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
            });

        });
    });
    //搜索
    function searchBtn(){
        tableIns.reload({
            where: {
                name:$("#name").val(),
                code:$("#code").val()
            }
        });
    };

    //改变窗口大小时，重置弹窗的高度，防止超出可视区域（如F12调出debug的操作）
    $(".newsAdd_btn").click(function () {
        index = layui.layer.open({
            id: '',
            title: "新增岗位",
            type: 2,
            fixed: true, //不固定
            maxmin: true,
            area: ['90%', '80%'],
            content: "positionAdd.html",
            success: function (layero, index) {
                setTimeout(function () {
                    layui.layer.tips('点击此处返回', '.layui-layer-setwin .layui-layer-close', {
                        tips: 3
                    });
                }, 500)
            }
        });
        // layui.layer.full(index);
    });
</script>
</body>
</html>